package com.microframework.base.core.util.sql;

import com.jfinal.plugin.druid.DruidPlugin;
import com.microframework.boot.datarule.model.domain.DbConfig;

public class DbConfigTestUtil {
	
    public static boolean isDataSourceHealthy(DbConfig dbConfig) {
        try {
            DruidPlugin druidPlugin = new DruidPlugin(dbConfig.getUrl(), dbConfig.getUsername(),dbConfig.getPassword());
            if( druidPlugin.start()) {
            	return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

}
